﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls; 

namespace KPIS.GERP.GBMS.APP_UI.Form
{
    public partial class _Test3 : System.Web.UI.Page
    {
        private Dictionary<string, UserControls._Test3> ucs = new Dictionary<string, UserControls._Test3>();

        protected void Page_Init(object sender, EventArgs e)
        {
            ucs.Add("555", GetUserControl("555"));
            ucs.Add("666", GetUserControl("666", "This is a pillow"));
            ucs.Add("777", GetUserControl("777", "This is a charm"));
            foreach (KeyValuePair<string, UserControls._Test3> c in ucs)
            {
                form1.Controls.Add(c.Value);
            }
        }
        private UserControls._Test3 GetUserControl(string record_seq, string name = "")
        {
            UserControls._Test3 ucx = (UserControls._Test3) Page.LoadControl("~/APP_UI/UserControls/_Test3.ascx");
            ucx.Record_Seq = Convert.ToInt32(record_seq);
            ucx.Name = name;
            return ucx;
        }

        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            ucs["555"].Name = "This is a book";
            ucs["777"].Name = "This is a pen";
        } 
    }
}